<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>弹性收缩</title>
    <style>
      .container {
        display: flex;
        width: 700px;
        height: 400px;
        background-color: #ccc;
      }

      /* 
        flex-shrink 项目收缩
        默认情况下,取值为1,表示即如果空间不足，该项目将缩小
        取值为0,表示项目不会被收缩
        取值越大,收缩的幅度越大
        收缩的极限是项目中的内容

        注意: 当内容空间足够时,压缩的比例是根据flex-shrink的值来定的,
        但是如果内容空间不足时,这个比例会被打破,因为压缩的极限是内容的正常呈现
      */
      .item1 {
        flex-shrink: 0;
        width: 150px;
        height: 150px;
        background-color: palegreen;
      }

      .item2 {
        flex-shrink: 1;
        width: 150px;
        height: 150px;
        background-color: paleturquoise;
      }

      .item3 {
        flex-shrink: 1;
        width: 150px;
        height: 150px;
        background-color: pink;
      }

      .item4 {
        flex-shrink: 2;
        width: 150px;
        height: 150px;
        background-color: peachpuff;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="item1">111</div>
      <div class="item2">222</div>
      <div class="item3">333</div>
      <div class="item4">444</div>
    </div>
  </body>
</html>
